home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_kyle_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
41KB
|
1,387 lines
# Jedi Knight Missions Cog Script
#
# KYLE_M.COG
#
# Main script for the player. Handles things like saber info,
# saber blocking animations, invulnerability at respawn, etc.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing player local
# The force-like weapon effects are handled in kyle_m.cog
# (since the projectile will be gone by the time the
# effects wear off.)
thing victim local
thing perp local
thing meCarbonited local
thing aiCarbonited local
template carboDummy=+CarboniteChar local
template csTpl=+CarboniteStem local
template c0Tpl=+CarboDebris_0 local
template c1Tpl=+CarboDebris_1 local
template c2Tpl=+CarboDebris_2 local
template c3Tpl=+CarboDebris_3 local
template c4Tpl=+CarboDebris_4 local
int debris local
int carboSector local
vector carboPosition local
int oldFlags local
sound hmmmSound=mj61031.wav local
int iAlignmentPriority=-1 local
int nextBlock=0 local
int bin local
int rank local
int force_blinding=0 local
int blindingEffectHandle=-1 local
int frozenEffectHandle=-1 local
int flashEffectHandle=-1 local
int PulledWeapon local
int i local
int j local
int k local
int m local
int playersector local
vector playerpos local
int bub local
vector tempvec local
flex tempflex local
flex defenseFactor=1.0 local
sound defenseSound=ForceDefense.wav local
template carboExplode=+sparks local
template tpl=+FPBryarPistol local
template tpl1 local
template tpl2=+FPBryarPistol local
template tpl3=+FPSTrifle local
template tpl4=+FPDetoLive local
template tpl5 local
template tpl6=+FPRepeaterGun local
template tpl7=+FPRailGun local
template tpl8=+seqchrg2 local
template tpl9=+FPConcRifle local
template tpl10=+FPBryarPistol local
template tpl11=+FPLightSaber local
template tpl12=+FPBlastech local
template tpl13=+FPScope local
template tpl14=+FPDetoLive local
template tpl15=+FPCrossbow local
template tpl16=+FPRepeaterGun local
template tpl17=+FPRailSeek local
template tpl18=+seqchrg2 local
template tpl19=+FPConcRifle local
template tpl20=+FPCarbGun local
template batteryTpl=+FPBattery local
template smoke_tpl=+heavysmoke local
int smoke local
int totalStop local
template teleport_particles=+telesparks local
sound teleportsnd=ForceThrow01.WAV local
sound freezeSound=freeze.WAV local
sound thawSound=thaw.WAV local
template bubble_tpl=bubble local
template bubble_tpl2=bubble2 local
template bubble_tpl3=bubble3 local
template splash_tpl=+watersplash local
template splash_tpl2=+watersplash2 local
int a_splash local
int sender local
int source local
keyframe povBlockAnim0=SabVblk0.key local
keyframe povBlockAnim1=SabVblk1.key local
keyframe povBlockAnim2=SabVblk2.key local
keyframe blockAnim0=KYblock0.key local
keyframe blockAnim1=KYblock1.key local
keyframe blockAnim2=KYblock2.key local
material tip_mat=saberorange0.mat local
material side_mat=saberorange1.mat local
template tpl_wall=+ssparks_wall local
template tpl_blood=+ssparks_blood local
template tpl_saber=+ssparks_saber local
int dummy=0 local
int blockPOVTrack=-1 local
int blockTrack=-1 local
int curWeapon local
int primaryWeapon local
int griptrackID=-1 local
int frozenNow=0 local
int flashNow=0 local
flex ftemp local
flex extraFreezeTime=0 local
flex extraBlindTime=0 local
flex flashLevelR=0 local
flex flashLevelG=0 local
flex flashLevelB=0 local
flex myParam=0.0 local
flex damageType local
flex damage local
int killedByRancor=0 local
int inbubble=0 local
message startup
message killed
message newplayer
message timer
message blocked
message skill
message damaged
message splash
message user0
message user1
message user5
message enterbubble
message exitbubble
message preblock
message trigger
message shutdown
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
// Let everyone know we're Kyle and not that Mara person.
SetInv(player, 67, 0.0);
// Turn Kyle's saber Orange.
jkSetSaberInfo(player, side_mat, tip_mat, 0.003, 0.001, 0.120, tpl_wall, tpl_blood, tpl_saber);
if(!IsMulti()) call init_kyle;
SetTimerEx(0.1, 2006, 0, 0); // Reset camera zoom
// Bubbles
if(IsMulti())
SetTimerEx(4 + 5 * rand(), 2, 0, 0);
else
SetTimerEx(2 + 5 * rand(), 2, 0, 0);
aiRemoveAlignmentPriority(-1); // Remove any extant alignment priorities.
Return;
# ........................................................................................
shutdown:
aiRemoveAlignmentPriority(-1); // Remove any extant alignment priorities.
return;
# ........................................................................................
killed:
if(player != GetSenderRef()) Return;
if(IsMulti())
{
CreateBackpack(player);
ClearActorFlags(player, 0x2000);
}
SetActionCog(-1, 0);
// Clear the secondary freezing and blinding flags
// (For carbonite and flash bombs).
ClearActorFlags(player, 0x18000000);
// clean up force powers stuff
totalStop = 1;
call stop_powers;
// clean up items stuff
if(frozenEffectHandle!=-1)
{
freeColorEffect(frozenEffectHandle);
frozenEffectHandle = -1;
}
extraFreezeTime = 0.0;
if(flashEffectHandle!=-1)
{
freeColorEffect(flashEffectHandle);
flashEffectHandle = -1;
}
extraBlindTime = 0.0;
flashNow = 0;
Return;
# ........................................................................................
damaged:
damageType = GetParam (1);
damage = GetParam(0);
// Special case for when the player is carbo frozen.
if (frozenNow)
{
// Unfreeze the player.
if(frozenEffectHandle!=-1)
{
freeColorEffect(frozenEffectHandle);
frozenEffectHandle = -1;
}
ClearActorFlags(player, 0x200000);
ClearActorFlags(player, 0x40000);
ClearThingFlags(player, 0x14);
ClearActorFlags(player, 0x40);
if (meCarbonited)
{
DestroyThing(meCarbonited);
meCarbonited = 0;
}
// broadcast the carbonite statue explosion to all players
SendTrigger(-1, 99001,
GetThingSector(player),
VectorX(GetThingPos(player)),
VectorY(GetThingPos(player)),
VectorZ(GetThingPos(player)));
frozenNow = 0;
ReturnEx(GetThingHealth(player) * 10);
}
else
{
if (damage >= GetThingHealth(player))
// If the user is about to get killed on the EWEB, switch to fists.
if (GetCurWeapon(player) == 10)
SelectWeapon(player, GetWeaponBin(1));
if (!IsMulti())
{
killedByRancor = 0;
if (damage >= GetThingHealth(player))
{
if (GetThingParent(GetSourceRef()) != player)
SendMessageEx(GetThingClassCog(GetThingParent(GetSourceRef())), user5, GetThingParent(GetSourceRef()), 0, 0, 0);
}
if (killedByRancor)
{
if (damage >= GetThingHealth(player))
damage = GetThingHealth(player) - 0.1;
}
else if (BitTest (damageType, 0x20))
call make_bubbles;
}
else if (BitTest (damageType, 0x01))
damage = damage * jkGetMultiParam (22);
else if (BitTest (damageType, 0x02))
damage = damage * jkGetMultiParam (23);
else if (BitTest (damageType, 0x04))
damage = damage * jkGetMultiParam (24);
else if (BitTest (damageType, 0x08))
damage = damage * jkGetMultiParam (25);
else if (BitTest (damageType, 0x10))
damage = damage * jkGetMultiParam (26);
else if (BitTest (damageType, 0x20))
{
call make_bubbles;
damage = damage * jkGetMultiParam (27);
}
else if (BitTest (damageType, 0x40))
damage = damage * jkGetMultiParam (28);
ReturnEx(damage);
}
Return;
# ........................................................................................
make_bubbles:
playersector = GetThingSector(player);
playerpos = VectorAdd(GetThingPos(player), '0 0 0.075');
for(bub = 1; bub < 1 + 3 * rand(); bub = bub + 1)
{
CreateThingAtPosNR(bubble_tpl[3 * rand()], playersector, VectorAdd(playerpos, VectorScale(VectorNorm(VectorSet(rand()-0.5, rand()-0.5, rand()-0.5)), 0.05)), '0 0 0');
Sleep(0.05);
// Don't create too many bubbles over the network...
if(!IsMulti())
{
CreateThingAtPos(bubble_tpl3, playersector, VectorAdd(playerpos, VectorScale(VectorNorm(VectorSet(rand()-0.5, rand()-0.5, rand()-0.5)), 0.05)), '0 0 0');
Sleep(0.05);
}
}
Return;
# ........................................................................................
newplayer:
// Shut all the power stuff down (just in case)
totalStop = 1;
call stop_powers;
call init_kyle;
// If it's multiplayer
if(IsMulti()) call init_multi_kyle;
// Start Bubbles
SetTimerEx(2 + 5 * rand(), 2, 0, 0);
Return;
# ........................................................................................
timer:
if(GetSenderId() == 1) // Invulnerable for a while
{
// make the player vulnerable again if 40 frames have
// been displayed, else add another half second...
if(jkGetOpenFrames() > 40)
ClearActorFlags(GetParam(0), 8);
else
SetTimerEx(0.50, 1, player, 0);
Return;
}
else
if(GetSenderId() == 2) // Bubbles check
{
if(GetThingHealth(player) < 1) Return;
if((GetThingFlags(player) & 0x2000000) && !(GetPhysicsFlags(player) & 0x100000))
call make_bubbles;
if(IsMulti())
SetTimerEx(4 + 5 * rand(), 2, 0, 0);
else
SetTimerEx(2 + 5 * rand(), 2, 0, 0);
Return;
}
else
if(GetSenderId() == 19)
{
// Remove the Force Defense icon
SetInvActivated(player, 19, 0);
Return;
}
else
if(GetSenderId() == 24)
{
// A pulled weapon must be made takeable again
SetCollideType(GetParam(0), 1);
Return;
}
else
if(GetSenderId() == 27)
{
if(blindingEffectHandle!=-1)
{
freeColorEffect(blindingEffectHandle);
blindingEffectHandle = -1;
}
// Get the effect ramping down
AddDynamicTint(player, 200 + 8 * rank, 210 + 10 * rank, 200 + 8 * rank);
ClearActorFlags(player, 0x800);
force_blinding = 0;
Return;
}
else
if(GetSenderId() == 31)
{
if(griptrackID != -1)
{
StopKey(player, griptrackID, 0.1);
griptrackID = -1;
}
ClearActorFlags(player, 0x40000);
Return;
}
else
if(GetSenderId() == 1035) // Thaw out
{
if (frozenNow)
{
if (!extraFreezeTime)
{
PlaySoundThing(thawSound, player, 1.0, -1, -1, 0x180);
if(frozenEffectHandle!=-1)
{
freeColorEffect(frozenEffectHandle);
frozenEffectHandle = -1;
}
ClearActorFlags(player, 0x200000);
ClearActorFlags(player, 0x40000);
ClearThingFlags(player, 0x14);
ClearActorFlags(player, 0x40);
if (meCarbonited)
{
DestroyThing(meCarbonited);
meCarbonited = 0;
}
frozenNow = 0;
}
else
{
// We've been hit more than once, so we need to extend the freeze time.
SetTimerEx(extraFreezeTime, 1035, player, 0); // Make an appointment for "Unthawing"
extraFreezeTime = 0.0;
}
}
Return;
}
else
if(GetSenderId() == 1036) // I can see!
{
if (flashLevelR > 0.3)
{
// If the effect handle was freed...
if(flashEffectHandle!=-1)
{
flashLevelR = flashLevelR - 0.3;
if (flashLevelG >= 0.3)
flashLevelG = flashLevelG - 0.3;
else
flashLevelG = 0.0;
if (flashLevelB >= 0.3)
flashLevelB = flashLevelB - 0.3;
else
flashLevelB = 0.0;
freeColorEffect(flashEffectHandle);
flashEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 40*flashLevelR, 40*flashLevelG, 40*flashLevelB, 1.0);
SetTimerEx(0.3, 1036, player, 0);
}
}
else
{
flashLevelR = 0.0;
flashLevelG = 0.0;
flashLevelB = 0.0;
flashNow = 0;
if(flashEffectHandle!=-1)
{
freeColorEffect(flashEffectHandle);
flashEffectHandle = -1;
}
}
Return;
}
else
if(GetSenderId() == 1100)
{
PlaySoundThing(hmmmSound, player, 1.0, -1, -1, 0x180);
}
else
if(GetSenderId() == 1200)
{
if (iAlignmentPriority != -1)
{
aiRemoveAlignmentPriority(iAlignmentPriority);
iAlignmentPriority = -1;
}
}
else
if(GetSenderId() == 102) // They (i.e. an AI thing) can see!
{
victim = GetParam(0);
ClearActorFlags(victim, 0x800);
}
else
if(GetSenderId() == 101) // They (i.e. an AI thing) are thawed!
{
victim = GetParam(0);
SendMessageEx(GetInvCog(player, 68), user1, victim, 0, 0, 0);
// Make actor visible
ClearThingFlags(victim, 0x14);
// Enable actor's AI
AIClearMode(victim, 0x2000);
// Destroy actor's carbonite dummy
DestroyThing(GetParam(1));
}
else
if(GetSenderId() == 2000) // Resync player pos over the net.
{
victim = GetParam(0);
SyncThingPos(victim);
}
else
if(GetSenderId() == 2001) // Arm the player with their primary weapon.
{
SelectWeapon(player, GetParam(0));
SetCurInvWeapon(player, GetParam(0));
// if it is the saber, make sure the blade is extended
if(GetParam(0) == 131)
jkSetFlags(player, 0x81);
}
else
if((GetSenderId() == 2005) || (GetSenderID() > 2100 && GetSenderID() < 2199))
// Put a thing on top of another thing.
{
SendTrigger(-1, 99002, GetParam(0), GetParam(1), 0, 0);
}
else
if(GetSenderId() == 2006) // Reset Zoom Params.
{
SetCameraZoom(0, 1.0, 500.0);
}
else
if(GetSenderId() == 2007) // Set a remote thing user data.
{
k = GetThingGUID(GetParam(0));
m = k / 0x10000;
k = k & 0xFFFF;
i = GetThingGUID(GetParam(1));
j = i / 0x10000;
i = i & 0xFFFF;
SendTrigger(-1, 99010, k, m, i, j);
}
Return;
# ........................................................................................
preblock:
// if(player != GetSenderRef()) Return;
//
// // Do we want to block something with the saber?
// if (GetInv(player, 14) < 0.1)
// {
// // Don't have the mana!
// ReturnEx(0);
// }
// else
// {
// ChangeInv(player, 14, 0.1);
ReturnEx(-1);
// }
return;
# ........................................................................................
blocked:
if(player != GetSenderRef()) Return;
if (blockPOVTrack != -1)
{
jkStopPOVKey( player, blockPOVTrack, 0.1 );
blockPOVTrack = -1;
}
if (blockTrack != -1)
{
StopKey( player, blockTrack, 0.1 );
blockTrack = -1;
}
// PlaySoundThing(hitSound14, player, 1.0, -1, -1, 0);
blockPOVTrack = jkPlayPOVKey(player, povBlockAnim0[nextBlock], 2, 0x1a);
blockTrack = PlayKey(player, blockAnim0[nextBlock], 2, 0x1a);
nextBlock = nextBlock + 1;
if(nextBlock > 2)
nextBlock = 0;
Return;
# ........................................................................................
// This message is sent from the weap_saber_m.cog
user0:
if (blockPOVTrack != -1)
{
jkStopPOVKey( player, blockPOVTrack, 0.1 );
blockPOVTrack = -1;
}
if (blockTrack != -1)
{
StopKey( player, blockTrack, 0.1 );
blockTrack = -1;
}
Return;
# ........................................................................................
// This message is sent by both the carbonite (exp_cpel)
// and flash bomb (exp_flash) explosion cogs.
user1:
if (GetParam(0) == 1) // Carbonite
{
victim = GetParam(2);
AISetMode(victim, 0x2000); // Disable the actor's AI.
AISetMoveThing(victim, victim); // Set the thing as it's own
// destination so it stops moving.
// Make victim invisible
SetThingFlags(victim, 0x14);
aiCarbonited = CreateThing(carboDummy, victim);
AttachThingToThing(aiCarbonited, victim);
SendMessageEx(GetInvCog(player, 68), user0, victim, 0, 0, 0);
SetTimerEx(GetParam(1), 101, victim, aiCarbonited); // Make an appointment for "Unthawing"
}
else
if (GetParam(0) == 2) // Flash bomb
{
victim = GetParam(2);
SetActorFlags(victim, 0x10000000);
SetTimerEx(GetParam(1), 102, victim, 0); // Make an appointment for "Unblinding"
}
else
if (GetParam(0) == 3) // Alignment jump
{
aiSetDistractor(-1);
if (iAlignmentPriority != -1)
{
aiRemoveAlignmentPriority(iAlignmentPriority);
iAlignmentPriority = -1;
}
iAlignmentPriority = aiAddAlignmentPriority(1.0, 3);
KillTimerEx(1200);
SetTimerEx(4.0, 1200, 0, 0);
}
Return;
# ........................................................................................
user5:
killedByRancor=1;
return;
# ........................................................................................
skill:
// player might be dead when skill: arrives over the net...
if(GetThingHealth(player) <= 0) Return;
// Handle multiplayer force power effects
bin = GetParam(0);
rank = GetParam(1);
defenseFactor = 1.0;
if(bin == 24) // Force Pull
{
ReturnEx(0);
if(inbubble || frozenNow) Return;
curWeapon = GetCurWeapon(player);
// check for unpullable weapons
if(curWeapon == 1) Return;
if(curWeapon == jkGetMultiParam(38)) Return;
if(curWeapon == jkGetMultiParam(39)) Return;
// Absorb makes player immune to Pull
if(IsInvActivated(player, 28)) Return;
// Force Defense
if(rand() < GetInv(player, 19) * 0.25)
{
SetInvActivated(player, 19, 1);
KillTimerEx(19);
SetTimerEx(0.5, 19, 0, 0);
defenseFactor = 1 - GetInv(player, 19) * 0.25;
PlaySoundThing(defenseSound, player, 1.0, -1, -1, 0x80);
}
// If the EWEB gun is up, point it at whoever's using the force on us.
if (curWeapon == 10)
{
if (GetSourceRef()) // if there is a source thing
{
// Calculate which part of the player was struck.
playerpos = GetThingPos(player);
tempvec = GetThingPos(GetThingParent(GetSourceRef()));
tempvec = VectorSub(tempvec, playerpos);
tempvec = VectorNorm(tempvec);
SetThingLook(player, tempvec);
}
}
else
{
// Special case for the scope. Pull the rifle instead.
if (curWeapon == 13) curWeapon = 3;
// Special case for the Manual Sequencer. Pull the automatic instead.
if (curWeapon == 18) curWeapon = 8;
// Create a powerup corresponding to the current weapon
// but if defense worked pull a battery instead...
if(defenseFactor == 1.0)
PulledWeapon = CreateThingAtPos(tpl[curWeapon], GetThingSector(player), GetThingPos(player), '0 0 0');
else
PulledWeapon = CreateThingAtPos(batteryTpl, GetThingSector(player), GetThingPos(player), '0 0 0');
// Make the powerup collide later
SetTimerEx(0.2, 24, PulledWeapon, 0);
// Duplicate for internet games
if (IsMulti())
SetTimerEx(0.25, 24, PulledWeapon, 0);
// Throw the powerup at the player
ApplyForce(PulledWeapon, VectorScale(VectorNorm(VectorSub(GetThingPos(GetSourceRef()), GetThingPos(player))), 30));
if(defenseFactor == 1.0)
{
// Remove the weapon from the player
ChangeInv(player, GetWeaponBin(curWeapon), -1);
// Switch to fists
SelectWeapon(player, 121);
}
ReturnEx(1);
}
Return;
}
else
if (bin == 27) // Force Blinding
{
ReturnEx(0);
if(inbubble || frozenNow) Return;
// Force Defense
if(GetInv(player, 19) != 0.0)
{
SetInvActivated(player, 19, 1);
KillTimerEx(19);
SetTimerEx(0.5, 19, 0, 0);
PlaySoundThing(defenseSound, player, 1.0, -1, -1, 0x80);
}
defenseFactor = 1 - GetInv(player, 19) * 0.1;
if((!force_blinding) && (!IsInvActivated(player, 23))) // Seeing makes player immune to Blinding
{
force_blinding = 1;
blindingEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 200 + 8 * rank, 210 + 10 * rank, 200 + 8 * rank, 1.0);
SetActorFlags(player, 0x800);
SetTimerEx(4 * rank * jkGetMultiParam (31) * defenseFactor, 27, player, 0);
ReturnEx(1);
}
Return;
}
else
if (bin == 31) // Force Grip
{
ReturnEx(0);
if(inbubble || frozenNow) Return;
// Protection makes player immune to Grip
if(IsInvActivated(player, 29)) Return;
// Force Defense
if(rand() < GetInv(player, 19) * 0.1)
{
SetInvActivated(player, 19, 1);
KillTimerEx(19);
SetTimerEx(0.5, 19, 0, 0);
Return;
}
griptrackID = PlayMode(player, 25);
SetActorFlags(player, 0x40000);
// Print("You are taking Grip damage");
jkPrintUNIString(player, 300);
DamageThing(player, 2 * rank * jkGetMultiParam(32) / (1 - GetInv(player, 19) * 0.125), 0x8, GetSourceRef());
SetTimerEx(0.5, 31, player, 0);
ReturnEx(1);
Return;
}
else
if (bin == 34) // Deadly Sight
{
ReturnEx(0);
if(inbubble) Return;
// Force Defense
if(rand() < GetInv(player, 19) * 0.1)
{
SetInvActivated(player, 19, 1);
KillTimerEx(19);
SetTimerEx(0.5, 19, 0, 0);
Return;
}
// Print("You are taking Deadly Sight damage");
jkPrintUNIString(player, 301);
DamageThing(player, 4 * rank * jkGetMultiParam (33), 0x8, GetSourceRef());
smoke = CreateThingAtPosNR(smoke_tpl, GetThingSector(player), GetThingPos(player), '0 0 0');
// Raise the tint above the normal damage tint
if(GetCurrentCamera() == 0)
AddDynamicTint(player, 0.15, 0.0, 0.07);
ReturnEx(1);
Return;
}
else
if (bin == 38) // Force Push
{
ReturnEx(0);
if(inbubble) Return;
// Absorb makes player immune to Push
if(IsInvActivated(player, 28)) Return;
// Force Defense
if(GetInv(player, 19) != 0.0)
{
SetInvActivated(player, 19, 1);
KillTimerEx(19);
SetTimerEx(0.5, 19, 0, 0);
PlaySoundThing(defenseSound, player, 1.0, -1, -1, 0x80);
}
defenseFactor = 1 - GetInv(player, 19) * 0.1;
ApplyForce(player, VectorScale(VectorNorm(VectorSub(GetThingPos(player),GetThingPos(GetSourceRef()))), 120 * rank * defenseFactor));
ReturnEx(1);
Return;
}
else
if (bin == 39) // Chain Lightning
{
ReturnEx(0);
if(inbubble) Return;
// Print("You are taking Chain Lightning damage");
jkPrintUNIString(player, 302);
// rank is actually the damage here
DamageThing(player, rank, 0x8, GetSourceRef());
ReturnEx(1);
Return;
}
else
if (bin == 1035) // Carbonite Freeze
{
if(!IsInvActivated(player, 62)) // Don't freeze if super shield is on.
if (GetCurWeapon(player) != 10) // Don't freeze if the EWEB is up.
{ // This is a kludge to avoid double
if (!frozenNow) // traffic on the 0x10 thing flag.
{ // Remind me to fix it if I forget - rf.
// print("Brrr...");
extraFreezeTime = 0;
frozenNow = 1;
PlaySoundThing(freezeSound, player, 1.0, -1, -1, 0x180);
StopThing(player);
SetActorFlags(player, 0x200000); // Freeze the player
SetActorFlags(player, 0x40000); // Freeze the player
SetActorFlags(player, 0x40);
// Invisibility
SetThingFlags(player, 0x14);
meCarbonited = CreateThing(carboDummy, player);
AttachThingToThing(meCarbonited, player);
// Warn some force powers that the player is carbonited so they terminate [YB]
SendMessageEx(GetInvCog(player, 31), user0, 0, 0, 0, 0); // grip
SendMessageEx(GetInvCog(player, 34), user0, 0, 0, 0, 0); // deadly sight
SendMessageEx(GetInvCog(player, 35), user0, 0, 0, 0, 0); // far sight
frozenEffectHandle = newColorEffect(0.5, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 1.0);
// Resync the player pos.
SetTimerEx(0.3, 2000, player, 0);
// Resync the statue pos
SetTimerEx(0.4, 2000, meCarbonited, 0);
// Stick the two things together.
SetTimerEx(0.2, 2007, meCarbonited, player);
SetTimerEx(0.7, 2007, meCarbonited, player);
// SetTimerEx(0.5, 2005, meCarbonited, player);
// SetTimerEx(0.7, 2100, meCarbonited, player);
// SetTimerEx(0.9, 2101, meCarbonited, player);
// SetTimerEx(0.6, 2102, player, meCarbonited);
// SetTimerEx(0.8, 2103, player, meCarbonited);
// SetTimerEx(1.0, 2104, player, meCarbonited);
// Rank is the length of the freeze in seconds.
SetTimerEx(rank * jkGetMultiParam (34), 1035, player, 0); // Make an appointment for "Unthawing"
}
else
{
// If we are already frozen, add the new freeze time to the old.
// extraFreezeTime = extraFreezeTime + rank * jkGetMultiParam (34);
}
}
}
else
if (bin == 1036) // Flash blinding
{
// Make the player "Blink"
if ((rank == -2) || (IsInvActivated(player, 23))) // Seeing makes player immune to Flash bombs
{
if (!flashNow)
{
if(flashEffectHandle!=-1)
freeColorEffect(flashEffectHandle);
flashEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 255, 255, 255, 1.0);
flashLevelR = 0.0;
flashLevelG = 0.0;
flashLevelB = 0.0;
SetTimerEx(0.1, 1036, player, 0);
flashNow = 1;
}
}
else if ((rank == -1) && (!IsInvActivated(player, 23))) // Seeing makes player immune to Flash bombs
{
if (!flashNow)
{
if(flashEffectHandle!=-1)
freeColorEffect(flashEffectHandle);
flashEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 0, 255, 0, 1.0);
flashLevelR = 0.0;
flashLevelG = 0.0;
flashLevelB = 0.0;
SetTimerEx(0.1, 1036, player, 0);
flashNow = 1;
}
}
else if ((flashLevelB < rank) && (!IsInvActivated(player, 23))) // Seeing makes player immune to Flash bombs
{
// Existing flash blindness grants
// partial resistance to new effects.
rank = rank - (flashLevelB / 2);
if (flashLevelB >= rank)
{
ReturnEx(-1);
return;
}
// Affect red, green and blue differently.
flashLevelR = rank*1.4;
flashLevelG = rank*1.2;
flashLevelB = rank*1.0;
if(flashEffectHandle!=-1)
freeColorEffect(flashEffectHandle);
flashEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 40*flashLevelR, 40*flashLevelG, 40*flashLevelB, 1.0);
if (!flashNow)
SetTimerEx(0.3, 1036, player, 0);
flashNow = 1;
}
}
else
if (bin == 1100)
{
if (GetInv(player, 93) < 2.0)
{
SetTimerEx(2.0, 1100, 0, 0);
SetInv(player, 93, 5.0 + rand() * 2.0);
}
else
{
ChangeInv(player, 93, -1.0);
}
}
ReturnEx(-1);
Return;
# ........................................................................................
splash:
// splash: messages are only sent to the local player's cogs
// (class cog and capture cog) for performance reasons...
sender = GetSenderRef();
source = GetSourceRef();
// actor or player ?
if((GetThingType(sender) == 2) || (GetThingType(sender) == 10))
{
// whatever source (i.e. enter or leave, don't care)
a_splash = CreateThingAtPosNR(splash_tpl2, GetThingSector(sender), GetThingPos(sender), '0 0 0');
}
// these are mostly the projectiles...
else
{
// on entering only
if(source == 1)
// not if player is submerged, but still do it if he's on the surface
if(!(GetThingFlags(player) & 0x2000000) || (GetPhysicsFlags(player) & 0x100000))
a_splash = CreateThingNR(splash_tpl, sender);
}
Return;
# ........................................................................................
init_kyle:
SetTimerEx(0.1, 2006, 0, 0); // Reset camera zoom
// make the player invul for a short time
SetActorFlags(player, 8);
SetTimerEx(2.00, 1, player, 0);
// Set Health to full
SetThingHealth(player, 100);
// Set Mana to full
SetInv(player, 14, GetInv(player, 20) * 50);
// Set Shields to 100 minimum
if(GetInv(player, 60) < 100) SetInv(player, 60, 100);
// Set Battery to 100 minimum
if(GetInv(player, 13) < 100) SetInv(player, 13, 100);
// Set the power boost to 1.0
SetInv(player, 63, 1.0);
// When player starts, give him fists, bryar, and a saber.
SetInv(player, 121, 1.0);
SetInv(player, 122, 1.0);
SetInv(player, 131, 1.0);
// Give 50 energy minimum
if(GetInv(player, 11) < 50) SetInv(player, 11, 50.0);
// Bacta
if(GetInv(player, 40) == 0)
SetInvAvailable(player, 40, 0);
else
SetInvAvailable(player, 40, 1);
// IR Goggles
if(GetInv(player, 41))
SetInvAvailable(player, 41, 1);
else
SetInvAvailable(player, 41, 0);
SetInvActivated(player, 41, 0);
// Field Light
SetInv(player, 42, 1);
SetInvAvailable(player, 42, 1);
SetInvActivated(player, 42, 0);
ClearActorFlags(player, 4);
jkEndTarget();
Return;
# ........................................................................................
init_multi_kyle:
// Clear all ammo
SetInv(player, 11, 50.0);
SetInv(player, 12, 0.0);
SetInv(player, 13, 75.0);
SetInv(player, 15, 0.0);
SetInv(player, 90, 0.0);
SetInv(player, 91, 0.0);
SetInv(player, 92, 0.0);
// Clear all weapons (except fists)
for (i = 122; i <= 140; i = i + 1)
SetInv (player, i, 0);
SetInv(player, GetWeaponBin(1), 1);
// Remove bacta tank and IR goggles
SetInv(player, 40, 0);
SetInv(player, 41, 0);
SetInvAvailable(player, 40, 0);
SetInvAvailable(player, 41, 0);
// Set shields to 100 by default
SetInv(player, 60, 100);
// Now initialize the inventory
for (i = 1; i <= 10; i = i + 1)
{
myParam = jkGetMultiParam (i*2);
if(myParam != 0)
SetInv(player, myParam, jkGetMultiParam(i*2+1));
}
// Make these available if they were initialized to non-zero
if (GetInv (player, 40) > 0)
SetInvAvailable (player, 40, 1);
if (GetInv (player, 41) > 0)
SetInvAvailable (player, 41, 1);
// Set the default running speed
ftemp = jkGetMultiParam (40);
if (ftemp > 0)
SetThingMaxVelocity (player, ftemp);
ftemp = jkGetMultiParam (41);
if (ftemp > 0)
SetThingMaxAngularVelocity (player, ftemp);
// Initialize mana
ftemp = GetInv(player, 20) * 50;
if (ftemp < jkGetMultiParam(120))
ftemp = jkGetMultiParam(120);
SetInv(player, 14, ftemp);
// Do respawn effects
dummy = CreateThingAtPos(teleport_particles, GetThingSector(player), GetThingPos(player), '0 0 0');
dummy = PlaySoundThing(teleportsnd, player, 1.0, -1, -1, 0x180);
// Yes this is a hack... I don't know who/what broke it but this kludges it [YB]
SetFireWait(player, -1);
SetMountWait(player, 0);
SetCurInvWeapon(player, 121);
SelectWeapon(player, jkGetMultiParam(1));
SetCurInvWeapon(player, jkGetMultiParam(1));
SetFireWait(player, -1);
SetMountWait(player, 0);
// Wait half a second, then select main weapon.
SetTimerEx(0.5, 2001, jkGetMultiParam(1), 0);
// saber only episode...
if(GetMultiModeFlags() & 0x2000)
{
// remove all ammo
SetInv(player, 11, 0.0);
SetInv(player, 12, 0.0);
SetInv(player, 15, 0.0);
SetInv(player, 90, 0.0);
SetInv(player, 91, 0.0);
SetInv(player, 92, 0.0);
// remove all weapons except fists and saber
for (i = 122; i <= 140; i = i + 1)
{
if(i != 131) SetInv(player, i, 0);
}
}
Return;
# ........................................................................................
enterbubble:
inbubble = 1;
totalStop = 0;
call stop_powers;
Return;
# ........................................................................................
exitbubble:
inbubble = 0;
Return;
# ........................................................................................
stop_powers:
if(blindingEffectHandle!=-1)
{
freeColorEffect(blindingEffectHandle);
blindingEffectHandle = -1;
}
ClearActorFlags(player, 0x800);
KillTimerEx(27);
force_blinding = 0;
// Do not turn off carbonite because we entered a bubble.
if (totalStop || !frozenNow)
{
ClearActorFlags(player, 0x200000);
ClearActorFlags(player, 0x40000);
ClearThingFlags(player, 0x14);
ClearActorFlags(player, 0x40);
if (meCarbonited)
{
DestroyThing(meCarbonited);
meCarbonited = 0;
}
}
if(griptrackID != -1)
{
StopKey(player, griptrackID, 0.1);
griptrackID = -1;
}
Return;
# ........................................................................................
trigger:
// TRIGGER_CARBXPLODE
if(GetSourceRef() == 99001)
{
carboSector = GetParam(0);
carboPosition = VectorSet(GetParam(1), GetParam(2), GetParam(3));
// switch to LOCAL | NOSYNC mode to do this operation
// so these 10 network messages are not sent to everyone...
oldFlags = GetCogFlags(GetSelfCog());
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), 0x240);
debris = CreateThingAtPos(c0Tpl, carboSector, carboPosition, '0 0 0');
SetThingVel(debris, VectorSet(rand()-0.5, rand()-0.5, 1.2));
debris = CreateThingAtPos(c1Tpl, carboSector, carboPosition, '0 0 0');
SetThingVel(debris, VectorSet(rand()-0.5, rand()-0.5, 1.2));
debris = CreateThingAtPos(c2Tpl, carboSector, carboPosition, '0 0 0');
SetThingVel(debris, VectorSet(rand()-0.5, rand()-0.5, 1.2));
debris = CreateThingAtPos(c3Tpl, carboSector, carboPosition, '0 0 0');
SetThingVel(debris, VectorSet(rand()-0.5, rand()-0.5, 1.2));
debris = CreateThingAtPos(c4Tpl, carboSector, carboPosition, '0 0 0');
SetThingVel(debris, VectorSet(rand()-0.5, rand()-0.5, 1.2));
// switch back to old mode
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), oldFlags);
}
else
if(GetSourceRef() == 99002) // Position one object on another
{
// switch to LOCAL | NOSYNC mode to do this operation
// so these 10 network messages are not sent to everyone...
oldFlags = GetCogFlags(GetSelfCog());
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), 0x240);
victim = GetParam(0);
perp = GetParam(1);
SetThingPosEx(victim, GetThingPos(perp), GetThingSector(perp));
// switch back to old mode
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), oldFlags);
}
else
if(GetSourceRef() == 99003) // Set an object's joint angle.
{
// switch to LOCAL | NOSYNC mode to do this operation
// so these 10 network messages are not sent to everyone...
oldFlags = GetCogFlags(GetSelfCog());
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), 0x240);
SetThingJointAngle(GetParam(0), GetParam(1), GetParam(2));
// Correct some stuff.
tempvec = GetThingLVec(GetParam(0));
tempvec = VectorSet(VectorX(tempvec), VectorY(tempvec), 0.0);
SetThingLook(GetParam(0), tempvec);
// switch back to old mode
ClearCogFlags(GetSelfCog(), 0xffffffff);
SetCogFlags(GetSelfCog(), oldFlags);
}
else
if(GetSourceRef() == 99010) // Set a thing's user data.
{
i = GetParam(2);
j = GetParam(3);
i = i | (j * 0x10000);
k = GetParam(0);
m = GetParam(1);
k = k | (m * 0x10000);
SetThingUserData(GetGuidThing(k), GetGuidThing(i)+5000);
}
Return;
end